package com.gougou.rest;

import com.gougou.pojo.TbUser;
import com.gougou.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户信息rest服务接口
 * @author EX-ZHANZHENQIANG001
 * @date 2018-04-18
 */
@RequestMapping("/rest")
@RestController
public class UserRestController {


    @Autowired
    private UserServiceImpl userService;


    @RequestMapping(value="/getUserList", method = RequestMethod.GET)
    public Object getUserList() {
        return userService.getUserByName(new TbUser("admin"));
    }


    @RequestMapping(value="/getUserByName/{userName}", method = {RequestMethod.GET,RequestMethod.POST})
    public Object getUserByName(@PathVariable String userName) {
        System.out.println(userName);
        return userService.getUserByName(new TbUser(userName));
    }

}
